


vec4 f_panel_build(in vec2 loc, in vec2 scale, in mat3x2 mat, in bool neat, in vec2 vert, in vec2 inWeights, out vec2 texCoord) {
	vec4 v = vec4(0.0, 0.0, 0.0, 1.0);

	mat2 rot;
	rot[0] = vec2(cos(mat[2].y), -sin(mat[2].y));
	rot[1] = vec2(sin(mat[2].y), cos(mat[2].y));

	//vec2 vert = rot * inPos;
	vec2 Invert = sign(mat[1]);
	float radius = min(min(abs(mat[1].x), abs(mat[1].y)),  mat[2].x);
	//缩放部分大小
	vec2 scale_size = max(abs(mat[1]) - radius, 0);
	v.xy = (vert * radius * Invert) + ((scale_size * Invert) * inWeights * rot);
	
	texCoord = v.xy / (mat[1]+1);

	v.xy += mat[0];
	v.xy *= m_Scale;
	v.xy += m_Loc;

	if(neat) v.xy = round(v.xy) + 0.5;

	return v;
}

